﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using hms.azureutillibrary.common;

namespace hms.azureutility.console
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hard Medium Soft Azure Utility Console App");

            const string connectionString =
            "DefaultEndpointsProtocol=https;AccountName=hmsteststorage;AccountKey=2o6ax/24K3Bor9uVexqlcAGrPwccT1RpgsdsHjanCm1Mv4iZyM4MgVKf7cdCRO6DtZ8lyqtdrS76JmzDJz7eDQ==";

            var blobHandler = new BlobHandler(StorageServiceManager.GetCloudStorageAccountFromConnectString(connectionString).CreateCloudBlobClient());

            var theCount = blobHandler.CountOfItems("testblobcontainer1", true).ContinueWith(c => Console.WriteLine("Blob Item count for testblobcontainer1 is " + c.Result));

            var theCountByExt =
                blobHandler.CountOfItemsByExtension("testblobcontainer1", true)
                    .ContinueWith(c =>
                    {
                        foreach (var keyValuePair in c.Result)
                        {
                            Console.WriteLine("Blob Item count for extension " + keyValuePair.Key + ": " + keyValuePair.Value);                       
                        }
                    });

            Console.WriteLine("waiting...");

            //Console.WriteLine("Blob Item count for testblobcontainer1 is " + blobHandler.CountOfItems("testblobcontainer1",true) );

            Console.Read();
        }
    }
}
